package com.example.social.api

import com.example.social.model.UserModel
import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.Call
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.Part
import retrofit2.http.Query

interface UserApiService {
    @POST("user/register")
    fun registerUser(@Body request: UserModel): Call<BaseResponse<String>>

    @POST("user/login")
    fun login(@Body loginRequest: LoginRequest): Call<BaseResponse<UserModel>>

    @Multipart
    @POST("pics/uploadAvatar")
    suspend fun uploadAvatar(
        @Part file: MultipartBody.Part
    ): Response<BaseResponse<String>>

    @POST("user/logout")
    fun logout(): Call<Void>

    @GET("user/current")
    fun getCurrentUser(): Call<BaseResponse<UserModel>>


    @GET("user/list")
    fun getUserList(): Call<BaseResponse<List<UserList>>>

    @GET("user/id")
    fun getUserById(@Query("uid") uid: String): Call<BaseResponse<UserModel>>

    @GET("user/getFollowList")
    fun getFollowList(@Query("userId") userId: String): Call<BaseResponse<Set<String>>>

    @GET("user/getFollowedList")
    fun getFollowedList(@Query("userId") userId: String): Call<BaseResponse<Set<String>>>

    @POST("user/followUser")
    fun followUser(
        @Query("userId") userId: String,
        @Query("followUserId") followUserId: String
    ): Call<BaseResponse<String>>

    @GET("user/unfollowUser")
    fun unfollowUser(@Query("userId") currentId:String,@Query("unfollowUserId") unfollowUserId:String):Call<BaseResponse<String>>

}
